aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/[username]/invoice
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/(app)/[username]/invoice')
-rw-r--r--src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte b/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte
index 9d9021a6..c0b504f8 100644
--- a/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte
+++ b/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte
@@ -56,7 +56,7 @@
export let data;
$: refresh(data);
- let { invoice, id, user } = data;
+ let { invoice, id, user, rates } = data;
let {
amount,
hash,
@@ -82,17 +82,19 @@
amount,
hash,
type,
- rate,
received,
prompt,
text,
tip,
- user: { username, currency }
+ user: { username }
} = invoice);
tipPercent = (tip / amount) * 100;
};
+ $: currency = user?.currency || invoice.currency;
+ $: rate = invoice.rate * (rates[currency] / rates[invoice.currency]);
+
$: tip = Math.round((amount / 100) * tipPercent);
$: amountFiat = parseFloat(((amount * rate) / sats).toFixed(2));